import request from '@/utils/request'

export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  // console.log('调用了登录函数')
  return request({
    url: 'oj/login/login',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: 'oj/login/user/info',
    method: 'post',
    params: { token }
  })
}

/** 学生注册 */
export function registerUser(username, password) {
  const data = {
    username,
    password
  }
  // console.log('调用了登录函数')
  return request({
    url: 'oj/login/register',
    method: 'post',
    data
  })
}

